#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<vector>
using namespace std;
class Solution {
    vector<vector<int>> ret;
    vector<int> path;
    int v = 0;
    int s = 0;
public:
    vector<vector<int>> combine(int n, int k) {
        v = n;
        s = k;
        dfs(1);
        return ret;
    }
    void dfs(int start)
    {
        if (path.size() == s)
        {
            ret.push_back(path);
            return;
        }
        for (int i = start; i <= v; i++)
        {
            path.push_back(i);
            dfs(i + 1);
            path.pop_back();
        }
    }
};